package com.shujia.data

import org.apache.flink.api.scala._
import org.apache.flink.api.common.operators.{Keys, Order, ResourceSpec}

object DataSort {

  def main(args: Array[String]): Unit = {

    val env = ExecutionEnvironment.getExecutionEnvironment
    env.setParallelism(1)

    val data = env.readTextFile("resources/data.txt")

    val sortDS = data.sortPartition(_.split(",")(2).toLong, Order.ASCENDING)

    sortDS.writeAsText("resources/sortData.txt")
    env.execute()

  }

}
